home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 January / EnterCD 0105.iso / Internet / Norton Internet Security 2005 / NIS_Retail.EXE / Setup / PControl / APP / pcwiz.dll / HTML / WIZ-SETPASSWORD.JS < prev    next >
Encoding:
JavaScript  |  2004-08-31  |  5.3 KB  |  190 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    wiz-SetPasswords (Javascript file for wiz-SetPasswords.HTM)
  6. //
  7. // Copyright (c) by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. var m_iCurrentPage = 1;
  12.  
  13. var NOT_PRESENT =0;
  14. var PRESENT = 1;
  15. var PRESENT_FAKE=2;
  16.  
  17.  
  18. function GetCurrentUser()
  19. {
  20.     var sProductType = UserManager.ProductType;
  21.  
  22.     UserName.innerText = window.parent.aAccounts[m_iCurrentPage - 1].m_sAccountName;
  23.  
  24.     // Set the user type
  25.     switch(window.parent.aAccounts[m_iCurrentPage - 1].m_iAccountType)
  26.     {
  27.  
  28.         case "0":
  29.             if (sProductType == "PT_PRO")
  30.             {
  31.                 UserType.innerText = StrID("ParentalProductivityRestricted_NISPRO_Caps");
  32.             }
  33.             else
  34.             {
  35.                 UserType.innerText = StrID("ParentalProductivityRestricted_NIS_Caps");
  36.             }
  37.             break;
  38.  
  39.         case "1":
  40.             UserType.innerText = StrID("ParentalProductivityTeenager");
  41.             break;
  42.  
  43.         case "2":
  44.             if (sProductType == "PT_PRO")
  45.             {
  46.                 UserType.innerText = StrID("ParentalProductivityStandard_NISPRO_Caps");
  47.             }
  48.             else
  49.             {
  50.                 UserType.innerText = StrID("ParentalProductivityStandard_NIS_Caps");
  51.             }
  52.             break;
  53.  
  54.         case "3":
  55.             UserType.innerText = StrID("ParentalProductivitySupervisor");
  56.             break;
  57.  
  58.         default:
  59.             UserType.innerText = StrID("ParentalProductivity_ThisErrorShouldNeverOccur");
  60.     }
  61. }
  62.  
  63. function SavePassword()
  64. {
  65.     window.parent.SetAccountInfo(m_iCurrentPage - 1, null, Pass.value, null);
  66. }
  67.  
  68. function OnLoad()
  69. {
  70.  
  71.     // Disable NextButton so user cannot constantly click next.
  72.     window.parent.frames("bottom").NextB.disabled = true;
  73.     
  74.     // If no accounts were created we can skip the "Set Password" page by simulating "Next Click"
  75.     if (window.parent.m_iAccounts < 1)
  76.     {
  77.         window.parent.frames("bottom",0).GoNext("Set Password");
  78.  
  79.     }
  80.     else
  81.     {
  82.         GetCurrentUser();   // Get First User
  83.         CurrentNum.innerText = m_iCurrentPage;
  84.         TotalNum.innerText = window.parent.m_iAccounts;
  85.     }
  86.     
  87.     // Enable NextButton
  88.     window.parent.frames("bottom").NextB.disabled = false;
  89. }
  90.  
  91.  
  92. function Page_GoNext()
  93. {
  94.     try
  95.     {
  96.         // Disable NextButton so user cannot constantly click next.
  97.         window.parent.frames("bottom").NextB.disabled = true;
  98.     
  99.     if (m_iCurrentPage < window.parent.m_iAccounts)
  100.     {
  101.         // Check Password if it is valid
  102.         if(Pass.value != PassConfirm.value)
  103.         {
  104.             alert(StrID("ParentalProductivity_PasswordError"));
  105.                 window.parent.frames("bottom").NextB.disabled = false;
  106.             return false;
  107.         }
  108.  
  109.         // If password in empty pass in empty string
  110.         if(!Pass.value)
  111.         {
  112.             Pass.value = "";
  113.         }
  114.  
  115.         SavePassword();     // Save Password off
  116.  
  117.         // Now update the page for next user
  118.         m_iCurrentPage++;                       // Increment "user" count
  119.         CurrentNum.innerText = m_iCurrentPage;  // Update text that refers to user count
  120.         Pass.value = "";                        // Clear password fields
  121.         PassConfirm.value = "";
  122.         GetCurrentUser();                       // Get Next user info
  123.  
  124.         Pass.focus();
  125.         
  126.             window.parent.frames("bottom").NextB.disabled = false;
  127.         return false;   // Return False because we do not want to go "next" just yet
  128.     }
  129.     else
  130.     {
  131.         // Check Last Password if it is valid
  132.         if(Pass.value != PassConfirm.value)
  133.         {
  134.             alert(StrID("ParentalProductivity_PasswordError"));
  135.                 window.parent.frames("bottom").NextB.disabled = false;
  136.             return false;
  137.         }
  138.  
  139.         // If password in empty pass in empty string
  140.         if(!Pass.value)
  141.         {
  142.             Pass.value = "";
  143.         }
  144.  
  145.         SavePassword(); // Save off last password
  146.  
  147.         // Now save off each account
  148.         for (i = 0; i < window.parent.m_iAccounts; i++)
  149.         {
  150.             // Now go ahead and create each account;
  151.             var name = window.parent.aAccounts[i].m_sAccountName;
  152.  
  153.             if(!name || name == "")
  154.                 name = " ";
  155.  
  156.             // call WrapUM to create this account
  157.             UserManager.CreateAccount(window.parent.aAccounts[i].m_sAccountName,
  158.                         window.parent.aAccounts[i].m_sAccountPassword,
  159.                         window.parent.aAccounts[i].m_iAccountType);
  160.         }
  161.  
  162.             // Enable NextButton
  163.             window.parent.frames("bottom").NextB.disabled = false;
  164.         return true;
  165.     }
  166. }
  167.     catch(err)
  168.     {
  169.         window.parent.frames("bottom").NextB.disabled = false;
  170.     }
  171. }
  172.  
  173.  
  174. function Page_GoBack()
  175. {
  176.     return true;
  177. }
  178.  
  179. function OnKeyDownHandler()
  180. {
  181.     // Last Control Tab over to the <back, next, close> button.
  182.     var VK_ESCAPE = 27;
  183.  
  184.     if (window.event.keyCode == VK_ESCAPE)
  185.     {
  186.         // Escape key.. We want to exit out of the wizard..
  187.         parent.window.navigate("res://closeme.xyz");
  188.     }
  189. }
  190.